#define DBG 0

/*
turf/building/

	icon = 'landintersection.png'

	Enter(atom/o)
		if(o.dir == NORTH)
			..()

		return*/


turf // credit FIREking
    var
        moves = NORTH | SOUTH | EAST | WEST
        openmoves = NORTH | SOUTH | EAST | WEST
        closedmoves = 0
        opened = 1
        building = 0

    Enter(atom/movable/a)
        if(!a.loc) return ..()
        var/move = get_dir(src, a)
        if((src.moves & move) != move)
            return 0
        if(building)
            view(1) << "[a] enters the [name]"
        return ..()

    Exit(atom/movable/a)
        if((src.moves & a.dir) != a.dir)
            return 0
        if(building)
            view(0) << "[a] exits the [name]"
        return ..()

    proc/get_density()
        if(density) return 1
        for(var/atom/a in src)
            if(a.density)
                return 1
        return 0

    proc/check_enter_move(atom/movable/a)
        var/move = get_dir(src, a)
        if((src.moves & move) != move)
            return 0
        return 1

    proc/check_exit_move(atom/movable/a)
        if((src.moves & a.dir) != a.dir)
            return 0
        return 1

turf/NS_tunnel
	moves = NORTH | SOUTH

	icon = 'landroad_n.png'
/*
turf/building
	icon = 'landintersection.png'

	moves = NORTH*/

turf/proc/t_ex()
	opened = !opened

	if(opened)
		moves = openmoves
	else
		moves = closedmoves

	if (DBG)
		world << moves
		world << openmoves
		world << closedmoves
		world << opened
